<template>
  <div>
    <typeNavMenu/>
    <!--列表-->
    <ListContainer />
    <!--今日推荐-->
    <TodayRecommend />
    <!-- 商品排行 -->
    <Rank />
    <!-- 猜你喜欢 -->
    <Like />

    <!--楼层Floor, 第一次在自定义标签上使用v-for  -->
    <!--楼层Floor, 第一次在自定义标签上使用v-for  -->
    <Floor v-for="(item, index) in floorList" :key="item.id" :floorItem ="item"/>


    <!--商标-->
    <Brand />
  </div>
</template>

<script>
import Brand from './Brand/Brand'
import Floor from './Floor/Floor'
import Like from './Like/Like'
import ListContainer from './ListContainer/ListContainer'
import Rank from './Rank/Rank'
import TodayRecommend from './TodayRecommend/TodayRecommend';

import {mapState} from 'vuex';

export default {
  name: "home",
  components: {
    Brand,
    Floor,
    Like,
    ListContainer,
    Rank,
    TodayRecommend,
  },

  mounted() {
    //派发action,获取floor组件的数据
    this.$store.dispatch("getFloorList");
    this.$store.dispatch('getUserInfo');
  },
  computed: {
    ...mapState({
      floorList: (state) => state.home.floorList,
    }),
  },
}
</script>

<style scoped>

</style>
